UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YilfQUqObyM0uJprFkRLkc2tiihAAxafUx5m1dWiFQ4='
WHERE
key_id = '6a27d88b551985577390319d55f5399dcf624d54528031b63a7c68fed422f22a'
AND (
token = 'YilfQUqObyM0uJprFkRLkc2tiihAAxafUx5m1dWiFQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)