UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tdqAsyb4ydHrYLW8OHHEfo1CQp4nALqSUXTPaduCaIc='
WHERE
key_id = 'fadb0b9a5736ef989362b89038b96b7a84a3b6539118d153c1eba729e7fa89c8'
AND (
token = 'tdqAsyb4ydHrYLW8OHHEfo1CQp4nALqSUXTPaduCaIc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)