UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NMjwNMm935omR+qRSpu3DhZ7Cy9CeV5nxnp4w5IyRk8='
WHERE
key_id = 'a4a8327b35e353cfe1a91345d5bbd2f757619c4823d58a067135898dd1acaa1a'
AND (
token = 'NMjwNMm935omR+qRSpu3DhZ7Cy9CeV5nxnp4w5IyRk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)