UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y1tHOwgRLPa0cqiwPaHp5nJ9PS4Nt3ayaC5DUWeSNDY='
WHERE
key_id = '47e01efaca07e991ba8da867ed2d5784579b11970d311b1efc3b3b8918e28abf'
AND (
token = 'Y1tHOwgRLPa0cqiwPaHp5nJ9PS4Nt3ayaC5DUWeSNDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)