UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oNJHJWrpDqfeqEgTOTXLotcWgYymW7/24gsSXSNPjjs='
WHERE
key_id = '387f0a007fc04a2d6df034f108b1ba2262f61cb1eb87f2eeddc2bd9740464bb2'
AND (
token = 'oNJHJWrpDqfeqEgTOTXLotcWgYymW7/24gsSXSNPjjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)