UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JVyGDsBzQNSqsTi7YLKf1CnEHhj9MrH4pN+CknpyFu0=' 
WHERE 
  key_id = 'cabc8775c6d5feab823f84c2261675e464e563a7248f2f1f3b05ba93aca931ff' 
  AND (
    token = 'JVyGDsBzQNSqsTi7YLKf1CnEHhj9MrH4pN+CknpyFu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050