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