UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyhtNdXs+aaneHEDH2FzjId0MZKUuf4Xly2b4BzjX8E=' 
WHERE 
  key_id = '22547237659bcf1043c2eafe2d0edb983523c3b981af59f4cba1e8e619d96778' 
  AND (
    token = 'VyhtNdXs+aaneHEDH2FzjId0MZKUuf4Xly2b4BzjX8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031