UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dj6SocmXsgd671rd6LsBKSYftXvSavb1tKoXRhSYC+A='
WHERE
key_id = 'cef4ce8db2661596cefcc19701625873b66312591184c3c5a54801d5fbac32d2'
AND (
token = 'dj6SocmXsgd671rd6LsBKSYftXvSavb1tKoXRhSYC+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)