UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XX+HIXOcvfYjKLot8Nt67AD7qmDaxx4YpB7JEqoBNM8='
WHERE
key_id = 'e0764817c2b5889376894d815b60789369047ead85e45ca3ef1c851d8438ee74'
AND (
token = 'XX+HIXOcvfYjKLot8Nt67AD7qmDaxx4YpB7JEqoBNM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)