UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X8ghZ1yzSYSodOv6OuY+36AuTLhuJUWkaaJYZ2HwUKg='
WHERE
key_id = 'ff9957f01d3ee0e90753dd250d2a4b52c5777a27fa126edabf4837ec48f3fb07'
AND (
token = 'X8ghZ1yzSYSodOv6OuY+36AuTLhuJUWkaaJYZ2HwUKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)