UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c9riuAq6t0wUfi/Y7w1Ac1w4bjhPML7c2A07y+pniws='
WHERE
key_id = '3726e63126ef2555c8e913e8f41343292f126c55ecc7966fb8ca8cade4169e4d'
AND (
token = 'c9riuAq6t0wUfi/Y7w1Ac1w4bjhPML7c2A07y+pniws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)