UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gijpfa+y30Z685U6bCfZ0X2WvEyXidjpPoFZEdlMPC0='
WHERE
key_id = 'd2e009c6a79494ca0db6efcce23a36df9379f70b4729ba284b856bf76508f0ab'
AND (
token = 'Gijpfa+y30Z685U6bCfZ0X2WvEyXidjpPoFZEdlMPC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)