UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AWfnnxPy1MgAVwYrdTuJCWAdHW3AOe9P4JNdmIkHFtQ='
WHERE
key_id = 'f8292daae793692b0d4a3d34867e3bb1c4d6d00ee1899a38346a644ef30642c1'
AND (
token = 'AWfnnxPy1MgAVwYrdTuJCWAdHW3AOe9P4JNdmIkHFtQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)