UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6OwzXT4URVaU/s7KBh1Z/pSCPcUZhWBCVQHr1Cd5JCU=' 
WHERE 
  key_id = 'ad778916e9ee5b41c5ac8f92ebcaea915e70230a1909d0472348544851ed5afd' 
  AND (
    token = '6OwzXT4URVaU/s7KBh1Z/pSCPcUZhWBCVQHr1Cd5JCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016