UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kJBe8VwzxU73iNS8Km/J3i6jhioRGHIJNuDomc7w0p4='
WHERE
key_id = '66a5cb990fcd30762eb79182db8e97846be0ded8bc402a724e0b9e7214910c02'
AND (
token = 'kJBe8VwzxU73iNS8Km/J3i6jhioRGHIJNuDomc7w0p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)