UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QGhmwokGKyATJJN/z5ORE1QY8VsLIxkrCOMEDFJGLs8='
WHERE
key_id = '85f013ce2c2d6b1212d9041187a318d2d02f92c865a56418ab924c2be5604c72'
AND (
token = 'QGhmwokGKyATJJN/z5ORE1QY8VsLIxkrCOMEDFJGLs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)