UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nW9FX78PrgxNbISZzp42xrS8NytK/cJ4uE+ccYr6HqU='
WHERE
key_id = 'aa85729c169acc9714e401663d63ab60fe916c10a23b71b4c503bea131d8e96b'
AND (
token = 'nW9FX78PrgxNbISZzp42xrS8NytK/cJ4uE+ccYr6HqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)