UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nZjLuB83iX8fLdtbRAPIJG1emyC19dNHBLZVk7jw8x0='
WHERE
key_id = '10e6e00b2e0f22c3567fb6633eb0746391aa1cf0b6763a2fd637f4d8bfd7f57d'
AND (
token = 'nZjLuB83iX8fLdtbRAPIJG1emyC19dNHBLZVk7jw8x0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)