UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '++NSHx7U8yWU2tSae1kplR+siclhQ0VKXPCm5a/FhqU=' 
WHERE 
  key_id = '20b989406a8e29a204c4f74b25731d269d2e1662664c0f1291ce486f12e3b75f' 
  AND (
    token = '++NSHx7U8yWU2tSae1kplR+siclhQ0VKXPCm5a/FhqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032