UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i9QzDjDvtWYMoqbJNY2YS7C8th/7a7Wb77PJxvrvgDA='
WHERE
key_id = 'def7fbbe6c953d21a96570c9385bb3cc02a4a40c2b6a18e1fbde4924abda9701'
AND (
token = 'i9QzDjDvtWYMoqbJNY2YS7C8th/7a7Wb77PJxvrvgDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)