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