UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8P9w4WuLplIh6jNB4hj/cm/DsAKeCpRepr7GHNFBT0I='
WHERE
key_id = 'eded01a8fd9acf08aee097595a8ed70edf37fda96e0aed283c0e82d540f8773c'
AND (
token = '8P9w4WuLplIh6jNB4hj/cm/DsAKeCpRepr7GHNFBT0I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)