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