UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iyTJpw8cHEtZFFZrVNsk77W6ctqoQovQNmSJW+/ytFw=' 
WHERE 
  key_id = '195490f85cd218b9306705ac1d7bbcc29feb9ea146be858e6b22607471aaec4c' 
  AND (
    token = 'iyTJpw8cHEtZFFZrVNsk77W6ctqoQovQNmSJW+/ytFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033