UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p4O34PuBJxEvkBEz7ALVeV7nepB82eQXsBBpukxYfeo='
WHERE
key_id = '5d56a5c89ab98166752b2f34b026e1b0e1ae41e66a8423092c3387fc9990a7bd'
AND (
token = 'p4O34PuBJxEvkBEz7ALVeV7nepB82eQXsBBpukxYfeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)