UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tm76rPTacVk6xDTUYvyDfnl9DGp8KXwOoA5OY2WGlmQ=' 
WHERE 
  key_id = '1eccd3121df5be82d5583ff15dc8253d7e36586e90b590243d4c015ef6926892' 
  AND (
    token = 'Tm76rPTacVk6xDTUYvyDfnl9DGp8KXwOoA5OY2WGlmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021