UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S9WeHMyOQCmq+6yzOHzq8VVk6VcYebOuAu+8g30xiYY='
WHERE
key_id = 'fba6a12c9edbc1857b8f97a5fbdae070889c74fe302424b9df511823eb9af2fa'
AND (
token = 'S9WeHMyOQCmq+6yzOHzq8VVk6VcYebOuAu+8g30xiYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)