UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hU/StL1nt7rZnX1WmG9/vVvNehPXzS07aZ9gisY+GNs=' 
WHERE 
  key_id = 'ec8e21d9cc691d4747c0eabb9f3b92128032e9f2b06e0911161a91e82ba0b440' 
  AND (
    token = 'hU/StL1nt7rZnX1WmG9/vVvNehPXzS07aZ9gisY+GNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018