UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hm0BeKVLMNBLnP+cjH4BCRBgT8ifDNHv76ubWBYqiuU=' 
WHERE 
  key_id = '8c733b7ded5f7c35657aa02eedd479345effea26b63ae51f4d10e6ddd11eb2b6' 
  AND (
    token = 'hm0BeKVLMNBLnP+cjH4BCRBgT8ifDNHv76ubWBYqiuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047