UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1doFw0zuttZLe1XzAZ35q0h/c25TIVKA6zntJNSn3eQ=' 
WHERE 
  key_id = '9e2159db86fa4b9143021f2d28d31d4df6899d5761c2bbc9f9b3af75b2a952f4' 
  AND (
    token = '1doFw0zuttZLe1XzAZ35q0h/c25TIVKA6zntJNSn3eQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016