UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8gbhAhEelEKSdfd3dMlW53V/zOCora2gq6AV4oUNfX8='
WHERE
key_id = '94ae7d8ee13ceffcf3615a22d2f56f4ea96e0df242f05193a9c4e21f3b2f30da'
AND (
token = '8gbhAhEelEKSdfd3dMlW53V/zOCora2gq6AV4oUNfX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)