UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q9QTDpIjCdL+4ovdwUjpGA1abGPlVOQP56xULRwCppE=' 
WHERE 
  key_id = '79031e1b71489e29294a78a01525fccecc314533501c4b57f676c852773a6a31' 
  AND (
    token = 'Q9QTDpIjCdL+4ovdwUjpGA1abGPlVOQP56xULRwCppE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031