UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XV0c+z8H4x8LsBqd+XrCEMo9rIbtQk6PSj6lI2R1KHQ='
WHERE
key_id = 'c6bb455ae83cd37338841a83d6f90349a3a001ded0c19d1038798f9e4d0b4020'
AND (
token = 'XV0c+z8H4x8LsBqd+XrCEMo9rIbtQk6PSj6lI2R1KHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)