UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tsIaXwRB+VODyDy9cCGaYoG06u881YL9IKRw+kZS8s0=' 
WHERE 
  key_id = '4ddf951baa3adf1a9685f58c3a889274738802a38b65cceae61af44c10486df2' 
  AND (
    token = 'tsIaXwRB+VODyDy9cCGaYoG06u881YL9IKRw+kZS8s0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037