UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KrDawfEdz1yw88M8cFQifjE1wyFQyn3Thjmh/b+K3I4=' 
WHERE 
  key_id = '6fedd57a5fd3728814594c59978c253b9907cf4f28bbdf2b3bfaad907d9e96a5' 
  AND (
    token = 'KrDawfEdz1yw88M8cFQifjE1wyFQyn3Thjmh/b+K3I4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032