UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QjLnt+YF8lMFskrqtLkAAJwstA6T33DnGn7WM2gbFwE='
WHERE
key_id = 'a38bbd08d25659dbef19d60f1939f454347543ade74dc1278d153c0b9b03ca36'
AND (
token = 'QjLnt+YF8lMFskrqtLkAAJwstA6T33DnGn7WM2gbFwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)