UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtYa5BGlhfUxn3Vv0vAXpks0RUkPDA1bG+nNWJg1VD0='
WHERE
key_id = '51f2903edcc2225f56adce931f0dc8726085dee812476068ed082ad24590acdb'
AND (
token = 'YtYa5BGlhfUxn3Vv0vAXpks0RUkPDA1bG+nNWJg1VD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)